<?php
require('config.php');
		$time=time();
        $goods_id=$_REQUEST['goods_id'];
        $isGoodsContent=0;
        if(isset($_REQUEST['isGoodsContent'])) $isGoodsContent=$_REQUEST['isGoodsContent'];
		$sql="select a.goodsDesc,a.goodsName,b.groupMaxCount,a.goodsImg,a.shopId,b.groupPrice,b.endTime,s.userTalkLink,s.shopImg,s.shopName from `".$oto."_goods` as a,`".$oto."_goods_group` as b,`".$oto."_shops` as s where a.isGroup='1' and a.goodsId=b.goodsId and a.shopId=b.shopId and b.goodsGroupStatus='1' and a.goodsId='{$goods_id}' and b.groupStatus='1' and a.shopId=s.shopId";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$goods_info[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(isset($goods_info))
		{
			$goods_info[0]['goodsDesc']=htmlspecialchars_decode($goods_info[0]['goodsDesc']);
			$time_star=time();
			$time_end=$time_star-3600*24*30;
			$time_star1=date('Y-m-d H:i:s',$time_end);
			$time_end1=date('Y-m-d H:i:s',$time_star);
			$sql="select * from `".$oto."_orders`,`".$oto."_order_goods` where ".$oto."_orders.orderId=".$oto."_order_goods.orderId and ".$oto."_order_goods.goodsId='{$goods_id}' and createTime>='$time_star1' and createTime<='$time_end1' and orderStatus in ('0','1','2','3','4') ";
			$result=$db->query($sql);
			while($row=$result->fetch_assoc()){
				$order_list[]=$row;//将取得的所有数据赋值给person_info数组
			}
			$sum=0;
			if(isset($order_list))
			{
				for($i=0;$i<count($order_list);$i++)
				{
					$sum+=$order_list[$i]['goodsNums'];
				}
			}
			$goods_info[0]['yue_xiaoliang']=$sum;
			$goods_info[0]['time']=$time;
			$goods_info[0]['goodsId']=$goods_id;
			if($isGoodsContent!=0) $goods_info[0]['goodsDesc']="";
		}
		echo json_encode($goods_info);
?>